﻿// ***********************************************************
// 系统参数
// Creator:yehui  Date:2013-02-06
// ***********************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using VipSys.Common.Library;


namespace VipSys.SystemEntity
{
    public class SystemParam
    {
        private static SystemParam m_Instance = null;
        /// <summary>
        /// 获取SystemParam对象实例
        /// </summary>
        public static SystemParam Instance
        {
            get
            {
                if (m_Instance == null)
                    m_Instance = new SystemParam();
                return m_Instance;
            }
        }
        private SystemParam()
        {

        }
        private log4net.ILog m_log = null;
        public log4net.ILog Log
        {

            get
            {
                if (m_log == null)
                {
                   
                    m_log = log4net.LogManager.GetLogger("");
                }
                return this.m_log;
            }
        }

        private bool m_bAutoClearPool = true;

        private string m_szConnectionString = string.Empty;
        /// <summary>
        /// 获取连接字符串
        /// </summary>
        public string ConnectionString
        {
            get
            {
                if (string.IsNullOrEmpty(this.m_szConnectionString))
                    this.m_szConnectionString = ConfigurationManager.AppSettings["conn"].ToString() + System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["vipsys_dbpath"].ToString());
                return this.m_szConnectionString;
            }
            set
            {
                this.m_szConnectionString = value;
            }
        }

        private string m_szWorkPath = string.Empty;
        /// <summary>
        /// 获取或设置程序工作路径
        /// </summary>
        public string WorkPath
        {
            set { this.m_szWorkPath = value; }
            get
            {
                if (string.IsNullOrEmpty(this.m_szWorkPath))
                {

                    string szDllPath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
                    this.m_szWorkPath = szDllPath;
                    return m_szWorkPath;
                }
                return this.m_szWorkPath;
            }
        }

        private DBAccess m_DBAccess = null;
        /// <summary>
        /// 数据库操作类
        /// </summary>
        public DBAccess DBAccess
        {
            get
            {
                if (this.m_DBAccess == null)
                {
                    this.m_DBAccess = new DBAccess();
                    this.m_DBAccess.ConnectionString = this.ConnectionString;
                }
                return this.m_DBAccess;
            }
        }
       



    }
}
